<html>
<head><meta charset="utf-8"><title>Building Rust 1.49.0 fails with missing libc imports · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html">Building Rust 1.49.0 fails with missing libc imports</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224323776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224323776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224323776">(Jan 28 2021 at 13:17)</a>:</h4>
<p>Hi! I'm trying to update the meta-rust Yocto Linux layer from Rust 1.47.0 to 1.49.0 (aka I'm cross-compiling Rust 1.49.0) and I'm hitting build problems:</p>
<div class="codehilite"><pre><span></span><code>error[E0432]: unresolved imports `libc::c_int`, `libc::c_void`
  --&gt; library/std/src/sys_common/net.rs:17:12
   |
17 | use libc::{c_int, c_void};
   |            ^^^^^  ^^^^^^ no `c_void` in the root
   |            |
   |            no `c_int` in the root
</code></pre></div>
<p>Apparently, Cargo/Rust doesn't get that its a "unix" system and includes none of the related libc parts during build.<br>
Any ideas? Has anything related changed between Rust 1.47.0 and 1.49.0?</p>



<a name="224323864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224323864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224323864">(Jan 28 2021 at 13:18)</a>:</h4>
<p>See <a href="https://pastebin.com/S6tuHZyx">https://pastebin.com/S6tuHZyx</a> for the full build log</p>



<a name="224323909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224323909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224323909">(Jan 28 2021 at 13:18)</a>:</h4>
<p>And <a href="https://github.com/ColinFinck/meta-rust/tree/update-to-rust-1.49.0">https://github.com/ColinFinck/meta-rust/tree/update-to-rust-1.49.0</a> for my current meta-rust tree</p>



<a name="224323974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224323974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224323974">(Jan 28 2021 at 13:19)</a>:</h4>
<p>what target are you building for? a custom one?</p>



<a name="224323998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224323998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224323998">(Jan 28 2021 at 13:19)</a>:</h4>
<p>Nope, x86_64 host and target</p>



<a name="224324102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224324102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224324102">(Jan 28 2021 at 13:20)</a>:</h4>
<p>The target is called <code>x86_64-linux</code>. This is not a builtin target. Where is the target specification json file?</p>



<a name="224324402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224324402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224324402">(Jan 28 2021 at 13:23)</a>:</h4>
<p>Seems to be autogenerated here: <a href="https://github.com/ColinFinck/meta-rust/blob/update-to-rust-1.49.0/recipes-devtools/rust/rust.inc#L319-L377">https://github.com/ColinFinck/meta-rust/blob/update-to-rust-1.49.0/recipes-devtools/rust/rust.inc#L319-L377</a></p>



<a name="224324835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224324835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224324835">(Jan 28 2021 at 13:26)</a>:</h4>
<p>Can you post the generated file? It seems to be created in <code>d.getVar('WORKDIR') + '/targets/'</code>.</p>



<a name="224325410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224325410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224325410">(Jan 28 2021 at 13:32)</a>:</h4>
<p>sure, give me some minutes. Just need to rebuild up to that point and not let Docker auto-remove the build container right after that..</p>



<a name="224328391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224328391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224328391">(Jan 28 2021 at 13:56)</a>:</h4>
<p>Finally, here we go:</p>
<div class="codehilite"><pre><span></span><code>{
    &quot;llvm-target&quot;: &quot;x86_64-unknown-linux-gnu&quot;,
    &quot;panic-strategy&quot;: &quot;unwind&quot;,
    &quot;target-endian&quot;: &quot;little&quot;,
    &quot;target-c-int-width&quot;: &quot;32&quot;,
    &quot;arch&quot;: &quot;x86_64&quot;,
    &quot;linker-is-gnu&quot;: true,
    &quot;dynamic-linking&quot;: true,
    &quot;ar&quot;: &quot;ar&quot;,
    &quot;target-pointer-width&quot;: &quot;64&quot;,
    &quot;has-elf-tls&quot;: true,
    &quot;os&quot;: &quot;linux&quot;,
    &quot;max-atomic-width&quot;: 64,
    &quot;env&quot;: &quot;gnu&quot;,
    &quot;target-family&quot;: &quot;unix&quot;,
    &quot;linker&quot;: &quot;gcc&quot;,
    &quot;linker-flavor&quot;: &quot;gcc&quot;,
    &quot;position-independent-executables&quot;: true,
    &quot;cpu&quot;: &quot;generic&quot;,
    &quot;vendor&quot;: &quot;unknown&quot;,
    &quot;has-rpath&quot;: true,
    &quot;data-layout&quot;: &quot;e-m:e-i64:64-f80:128-n8:16:32:64-S128&quot;,
    &quot;executables&quot;: true
}
</code></pre></div>



<a name="224329772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224329772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224329772">(Jan 28 2021 at 14:07)</a>:</h4>
<p>The <code>cpu</code> and <code>data-layout</code> differ from the <code>x86_64-unknown-linux-gnu</code> target spec. In addition a few fields are missing here. I wouldn't expect any of this to cause this error though. For reference this is the target spec of <code>x86_64-unknown-linux-gnu</code>:</p>
<div class="codehilite" data-code-language="jsonc"><pre><span></span><code>// rustc --print target-spec-json -Zunstable-options
{
  "arch": "x86_64",
  "cpu": "x86-64",
  "crt-static-respected": true,
  "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
  "dynamic-linking": true,
  "env": "gnu",
  "executables": true,
  "has-elf-tls": true,
  "has-rpath": true,
  "is-builtin": true,
  "linker-is-gnu": true,
  "llvm-target": "x86_64-unknown-linux-gnu",
  "max-atomic-width": 64,
  "os": "linux",
  "position-independent-executables": true,
  "pre-link-args": {
    "gcc": [
      "-Wl,--as-needed",
      "-Wl,-z,noexecstack",
      "-m64"
    ]
  },
  "relro-level": "full",
  "stack-probes": {
    "kind": "inline-or-call",
    "min-llvm-version-for-inline": [
      11,
      0,
      1
    ]
  },
  "target-family": "unix",
  "target-pointer-width": "64"
}
</code></pre></div>



<a name="224457271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224457271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224457271">(Jan 29 2021 at 11:13)</a>:</h4>
<p>Yeah, even if I change <code>cpu</code> and <code>data-layout</code> to your values, it still fails.</p>



<a name="224457568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224457568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224457568">(Jan 29 2021 at 11:16)</a>:</h4>
<p>I'm currently trying out the full <code>rustc</code> command line that cargo emits</p>



<a name="224457750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224457750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224457750">(Jan 29 2021 at 11:18)</a>:</h4>
<p>It contains a <code>"--target" "x86_64-linux"</code> parameter and when I write arbitrary junk into that file, <code>rustc</code> fails differently. So I can confirm that my "x86_64-linux.json" target file is picked up by <code>rustc</code></p>



<a name="224457947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224457947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224457947">(Jan 29 2021 at 11:20)</a>:</h4>
<p>yet, I can also confirm that <code>#[cfg(unix)]</code> (and probably more) is not passed down to <code>rustc</code>:<br>
Adding</p>
<div class="codehilite"><pre><span></span><code>#[cfg(not(unix))]
mod bla;
</code></pre></div>
<p>to the file that is being compiled by <code>rustc</code> (library/std/src/lib.rs) emits another error message that module "bla" isn't found</p>



<a name="224458015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224458015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224458015">(Jan 29 2021 at 11:21)</a>:</h4>
<p>changing that to <code>#[cfg(unix)]</code> does not emit the error --&gt; The <code>unix</code> cfg is obviously not set</p>



<a name="224458103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224458103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224458103">(Jan 29 2021 at 11:22)</a>:</h4>
<p>For the record, this is the <code>rustc</code> command line that is failing:</p>



<a name="224458109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224458109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224458109">(Jan 29 2021 at 11:22)</a>:</h4>
<p><code>"/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--crate-name" "std" "--edition=2018" "library/std/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi" "--crate-type" "dylib" "--crate-type" "rlib" "--emit=dep-info,link" "-C" "prefer-dynamic" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "debuginfo=0" "--cfg" "feature=\"addr2line\"" "--cfg" "feature=\"backtrace\"" "--cfg" "feature=\"compiler-builtins-c\"" "--cfg" "feature=\"gimli-symbolize\"" "--cfg" "feature=\"miniz_oxide\"" "--cfg" "feature=\"object\"" "--cfg" "feature=\"panic_unwind\"" "--cfg" "feature=\"std_detect_dlsym_getauxval\"" "--cfg" "feature=\"std_detect_file_io\"" "-C" "metadata=0689b0d4825be2a9" "-C" "extra-filename=-0689b0d4825be2a9" "--out-dir" "/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps" "--target" "x86_64-linux" "-C" "linker=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/wrapper/target-rust-cc" "-L" "dependency=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps" "-L" "dependency=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" "--extern" "addr2line=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libaddr2line-edcfc31306b8709a.rlib" "--extern" "alloc=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/liballoc-f4b8ef2a33c74c1e.rlib" "--extern" "cfg_if=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libcfg_if-8695175b24530bb4.rlib" "--extern" "compiler_builtins=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libcompiler_builtins-04a67786e44ac3ca.rlib" "--extern" "core=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libcore-cd81f58443142307.rlib" "--extern" "hashbrown=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libhashbrown-16cf52eb19e44dac.rlib" "--extern" "libc=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/liblibc-62d36dccb1bc86e8.rlib" "--extern" "miniz_oxide=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libminiz_oxide-859c882c14d03951.rlib" "--extern" "object=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libobject-9fba61ca3b99b7cf.rlib" "--extern" "panic_abort=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libpanic_abort-2f44dc7b83590ef3.rlib" "--extern" "panic_unwind=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libpanic_unwind-bdd13821053c09ac.rlib" "--extern" "rustc_demangle=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/librustc_demangle-37c721caed3440d7.rlib" "--extern" "unwind=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/deps/libunwind-32055743aebf7e9c.rlib" "-Zmacro-backtrace" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Z" "binary-dep-depinfo" "--cfg" "backtrace_in_libstd" "-L" "native=/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-linux/release/build/compiler_builtins-d834d867a1b86082/out" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "--sysroot" "/drone/src/build-apu2/tmp/work/x86_64-linux/rust-native/1.49.0-r0/rustc-1.49.0-src/build/x86_64-unknown-linux-gnu/stage1" "-Z" "force-unstable-if-unmarked"</code></p>



<a name="224460999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224460999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224460999">(Jan 29 2021 at 11:58)</a>:</h4>
<p>Ok, I've tracked that problem down to a regression from Rust 1.48.0 to Rust 1.49.0 that is however fixed in Rust 1.50.0-beta.8</p>



<a name="224461019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461019">(Jan 29 2021 at 11:58)</a>:</h4>
<p>My minimal example now is as follows:</p>



<a name="224461038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461038">(Jan 29 2021 at 11:58)</a>:</h4>
<p><a href="http://test.rs">test.rs</a>:</p>
<div class="codehilite"><pre><span></span><code>#[cfg(unix)]
mod unix;

#[cfg(not(unix))]
mod not_unix;
</code></pre></div>



<a name="224461053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461053">(Jan 29 2021 at 11:58)</a>:</h4>
<p><code>rustc --target x86_64-linux test.rs</code></p>



<a name="224461084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461084">(Jan 29 2021 at 11:59)</a>:</h4>
<p>With 1.48.0 and 1.50.0-beta.8, I get: <code>error[E0583]: file not found for module unix</code></p>



<a name="224461158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461158">(Jan 29 2021 at 12:00)</a>:</h4>
<p>With 1.49.0, I get: <code>error[E0583]: file not found for module not_unix</code></p>



<a name="224461189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461189">(Jan 29 2021 at 12:00)</a>:</h4>
<p>Looks like someone else noticed already and fixed. Can someone pinpoint me to a bug report/PR/commit?</p>



<a name="224461464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461464">(Jan 29 2021 at 12:03)</a>:</h4>
<p>Can you try adding <code>"target_family": "unix"</code>? Notice the <code>_</code> instead of <code>-</code>. I think <a href="https://github.com/rust-lang/rust/commit/dc004d4809f7e5fb5ea73ac630a0b1bdb58eabe4">dc004d4809f7e5fb5ea73ac630a0b1bdb58eabe4</a> accidentally renamed it from <code>target-family</code> to <code>target_family</code>.</p>



<a name="224461515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461515">(Jan 29 2021 at 12:04)</a>:</h4>
<p><span class="user-mention" data-user-id="350190">@Colin Finck</span> ^</p>



<a name="224461590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461590">(Jan 29 2021 at 12:05)</a>:</h4>
<p>Yep, that does the trick! :)</p>



<a name="224461599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461599">(Jan 29 2021 at 12:05)</a>:</h4>
<p>Thanks a lot!</p>



<a name="224461623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461623">(Jan 29 2021 at 12:05)</a>:</h4>
<p>I will open an issue about this accidental rename.</p>



<a name="224461706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461706">(Jan 29 2021 at 12:06)</a>:</h4>
<p>Now the open question is: When did they accidentally fix it again? :D</p>



<a name="224461727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461727">(Jan 29 2021 at 12:07)</a>:</h4>
<p>Considering that 1.50.0-beta.8 is not affected</p>



<a name="224461861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224461861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224461861">(Jan 29 2021 at 12:08)</a>:</h4>
<p>It is fixed? Does <code>rustc --print cfg</code> show <code>unix</code> for 1.50.0-beta.8?</p>



<a name="224462123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462123">(Jan 29 2021 at 12:12)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/commit/dd682cb48c8b667859dded98a4bbfbd891a1eca4">https://github.com/rust-lang/rust/commit/dd682cb48c8b667859dded98a4bbfbd891a1eca4</a> looks suspicious</p>



<a name="224462143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462143">(Jan 29 2021 at 12:12)</a>:</h4>
<p>only 4 days later than the faulty commit - but apparently didn't make it into 1.49.0</p>



<a name="224462254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462254">(Jan 29 2021 at 12:14)</a>:</h4>
<p>And yes <span class="user-mention" data-user-id="133247">@bjorn3</span>, I can confirm that <code>rustc --target x86_64-linux --print cfg</code> prints <code>target_family="unix"</code> on Rust 1.50.0-beta.8, but not on 1.49.0</p>



<a name="224462300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462300">(Jan 29 2021 at 12:14)</a>:</h4>
<p>unless I add <code>"target_family": "unix",</code> to the JSON file</p>



<a name="224462365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462365">(Jan 29 2021 at 12:15)</a>:</h4>
<p>No, I mean just <code>unix</code>, not <code>target_family="unix"</code>.</p>



<a name="224462506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462506">(Jan 29 2021 at 12:16)</a>:</h4>
<p>Yes, same for <code>unix</code>. Works on 1.50.0-beta.8, but not on 1.49.0</p>



<a name="224462931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462931">(Jan 29 2021 at 12:22)</a>:</h4>
<p>Does this deserve a bug report anyway?</p>



<a name="224462972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224462972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224462972">(Jan 29 2021 at 12:23)</a>:</h4>
<p>Considering that 1.49.0 is latest stable, other people may well run into the same problem and need the same workaround as me (adding underscore options for the affected dashed options)</p>



<a name="224463188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224463188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224463188">(Jan 29 2021 at 12:26)</a>:</h4>
<p>Let me know if and where to report that (e.g. if there is a place for known problems with a stable release)</p>



<a name="224464500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224464500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224464500">(Jan 29 2021 at 12:40)</a>:</h4>
<p>Target spec json files are semi-unstable. While rustc does technically accept them on stable, it is not possible to build the corresponding libcore on stable.</p>



<a name="224464666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224464666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224464666">(Jan 29 2021 at 12:42)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/71009">#71009</a></p>



<a name="224692158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/224692158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#224692158">(Feb 01 2021 at 07:15)</a>:</h4>
<p>Is there some reason you need to use a target file?</p>



<a name="225147120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/225147120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Colin Finck <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#225147120">(Feb 04 2021 at 11:27)</a>:</h4>
<p>Yes, meta-rust needs to be able to build for any target that Yocto supports. It generates the target JSON file accordingly: <a href="https://github.com/meta-rust/meta-rust/blob/master/recipes-devtools/rust/rust.inc#L319">https://github.com/meta-rust/meta-rust/blob/master/recipes-devtools/rust/rust.inc#L319</a></p>



<a name="225807633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Building%20Rust%201.49.0%20fails%20with%20missing%20libc%20imports/near/225807633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Building.20Rust.201.2E49.2E0.20fails.20with.20missing.20libc.20imports.html#225807633">(Feb 10 2021 at 08:48)</a>:</h4>
<p>I'm saying, could you instead have a mapping to Rust targets, rather than recreating them?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>